/*
 * To change this template, choose Tools | Template Manager
 * and open the template in the editor.
 */
package model.common.ibatis;

import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;

import org.apache.commons.beanutils.BeanMap;
import org.apache.log4j.Logger;

/**
 * @Archivo IbatisUtils.java
 * @Fecha                @Autor   @Cambios
 * 21/01/2011 02:20:41 PM       moshiro
 */
public class IbatisUtils {

    private static Logger logger = Logger.getLogger(IbatisUtils.class);

    /** Creates a new instance of IbatisUtil */
    public static Map processBean(Object bean) {
        Map map = new HashMap();
        try {
            BeanMap beanMap = new BeanMap(bean);
            Iterator it = beanMap.keyIterator();
            while (it.hasNext()) {
                String key = (String) it.next();
                map.put(key, beanMap.get(key));
            }
        } catch (Exception ex) {
            logger.warn(ex);
        }
        return map;
    }
}
